//
//  ZNetworkingObject.m
//  NSURLSession封装
//
//  Created by 周成龙 on 16/11/1.
//  Copyright © 2016年 ZCL. All rights reserved.
//

#import "ZNetworkingObject.h"

#import "ZSessionHeader.h"

#define HOST_API @"http://v2.api.vdianjing.com/"

@interface ZNetworkingObject ()<NSURLSessionDelegate, NSURLSessionTaskDelegate, NSURLSessionDataDelegate>

@property (nonatomic, strong) NSMutableData *dataM;
@property (nonatomic, strong) NSString *className;

@end

@implementation ZNetworkingObject

+ (instancetype)objectWithClassName:(NSString *)className {
    ZNetworkingObject *obj = [[ZNetworkingObject alloc] init];
    obj.className = className;
    return obj;
}

- (void) rr {
    NSURL *url = [NSURL URLWithString:@"http://siyi.api.xt-cloud.com/show"];
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
    // 默认就是GET请求，要发POST请求的话，就必须更改请求方式
    request.HTTPMethod = @"POST";
    
    NSDictionary *dict = @{@"action":@"getShowIndex"};
    NSString *bodyString = [NSString JSONStringWithDiction:dict];
    request.HTTPBody = [bodyString dataUsingEncoding:NSUTF8StringEncoding];
    
    NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration] delegate:self delegateQueue:nil];
    NSURLSessionDataTask *task = [session dataTaskWithRequest:request];
    [task resume];
}

- (void)postCopleteData:(completeBlock)completeBlock {
    
}

@end
